package com.ctshk.common.enums;

import java.util.Arrays;

/**
 * TODO
 * 签证来源枚举
 * @author huangxiansheng
 * @date 2021/5/11 5:20 下午
 */
public enum VisaSource {

    VISA_SOURCE(1,"簽證訂單"),
    VISA_MANAGE_SOURCE(2,"簽證辦理訂單"),
    ;

    private Integer code;
    private String msg;

    VisaSource(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 通过key拿订单状态名称
     * gzl-wansi001
     * @param code
     * @return
     */
    public static String getVisaSourceName(Integer code){
        OrderSource orderPaymentStatus = Arrays.stream(OrderSource.values())
                .filter(enums -> enums.getCode().equals(code)).findFirst().orElse(null);

        if(orderPaymentStatus != null){
            return orderPaymentStatus.getMsg();
        }
        return "";
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
